String s1 = new String();
byte[] b1 = {97.98.99.100}; // ASCII code
String s2 = new String(b1);
System.out.println(s1);
System.out.println(s2);
String s3 = new String(b1, 1 2);
System.out.println(s3);
String s4 = "Hello, Sea";
System.out.println(s4);
System.out.println(s2.charAT(2));
System.out.println("Hello, Sea".charAT(2));
}
}
跑出:
abcd
bc
Hello, Sea
c
l